package com.farsoon.childcommon.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(value = "业务基础实体类")
public class BusinessBaseEntity<T extends Model<?>> extends BaseEntity<T> {

    private static final long serialVersionUID = -5625341461530685160L;

    @ApiModelProperty(value = "创建人ID", example = "1750679591587348481")
    @TableField(value = "create_by", fill = FieldFill.INSERT, insertStrategy = FieldStrategy.NOT_NULL)
    private Long createBy;

    @ApiModelProperty(value = "创建人名称", example = "张三")
    @TableField(value = "create_name", fill = FieldFill.INSERT, insertStrategy = FieldStrategy.NOT_NULL)
    private String createName;

    @ApiModelProperty(value = "创建时间", example = "2024-01-01 00:00:00")
    @TableField(value = "create_time", fill = FieldFill.INSERT, insertStrategy = FieldStrategy.NOT_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "修改人ID", example = "1750679591587348481")
    @TableField(value = "update_by", fill = FieldFill.UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
    private Long updateBy;

    @ApiModelProperty(value = "修改人名称", example = "李四")
    @TableField(value = "update_name", fill = FieldFill.UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
    private String updateName;

    @ApiModelProperty(value = "修改时间", example = "2024-01-01 00:00:00")
    @TableField(value = "update_time", fill = FieldFill.UPDATE, updateStrategy = FieldStrategy.NOT_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    /**
     * isDeleted数据库设置为tinyInt且非null 默认值为0表示false 未删除
     */
    @ApiModelProperty("删除标志（false存在 true删除）")
    @TableField(value = "is_deleted")
    @TableLogic
    private Boolean isDeleted;

}